import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { User } from './User';
import { GroupMember } from './GroupMember';

@Entity('chat_groups')
export class ChatGroup {
  @PrimaryGeneratedColumn()
  group_id!: number;

  @Column({ length: 100 })
  group_name!: string;

  @Column()
  created_by!: number;

  @CreateDateColumn()
  created_at!: Date;

  @ManyToOne(() => User)
  @JoinColumn({ name: 'created_by' })
  creator!: User;

  @OneToMany(() => GroupMember, member => member.group)
  members!: GroupMember[];
} 